﻿(function () {
    'use strict'
    appModule.directive("map", ['map', '$parse', function (map, $parse) {
        return {
            restrict: "A",
            scope: true,
            link: function (scope, element, attrs) {
                //获取控制器中定义的地图配置config对象
                var model = $parse(attrs.map);
                var config = model(scope);
                //实例化地图service，将指令元素作为容器传入
                //传入config对象
                var mapObj = new map(element[0], config);
                //开始加载
                mapObj.load();
            }
        };
    }]);
})();